package com.honey.solr.analyzer;

import com.honey.compilation.xml.XmlElement;
import com.honey.solr.SolrConstant;

public class GeneralAnalyzer extends BaseAnalyzer {
	
	@Override
	public String getFieldTypeName() {
		return SolrConstant.SOLR_SCHEMA_GENERAL_FIELD_TYPE;
	}
	
	@Override
	public XmlElement getIndexTokenizer() {
		XmlElement analyzer = new XmlElement("analyzer").addAttribute("type", "index"); 
		new XmlElement(analyzer,"tokenizer")
		.addAttribute("class", "solr.StandardTokenizerFactory")
		;
		return analyzer;
	}
	
	@Override
	public XmlElement getQueryTokenizer() {
		XmlElement analyzer = new XmlElement("analyzer").addAttribute("type", "query"); 
		new XmlElement(analyzer,"tokenizer")
		.addAttribute("class", "solr.StandardTokenizerFactory")
		.addAttribute("useSmart","true")
		;
		
		new XmlElement(analyzer,"filter")
		.addAttribute("class", "solr.SynonymFilterFactory")
		.addAttribute("synonyms", "synonyms.txt")
		.addAttribute("ignoreCase", "true")
		.addAttribute("expand", "true")
		;
		return analyzer;
	}

	@Override
	public String getXmlDoc() {
		
		return "通用的词法分析器. 对中文支持不是很理想, 建议使用中文的词法分析器,例如: ik, paoding ";
	}
}
